package com.ddpt.platform.common.util;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Snowflake;

import java.util.Date;
import java.util.Random;

public class IdUtil {

    private static final Snowflake snowflake;

    static {
        snowflake = new Snowflake(new Date(DateUtil.beginOfYear(new Date()).getTime()),
                new Random().nextInt(30)+1,
                new Random().nextInt(30)+1,
                false);
    }

    public static Long nextId(){
        return snowflake.nextId();
    }
}
